package com.bat.client.controller;

import com.bat.client.service.AsyncService;
import com.bat.conf.BaseController;
import com.bat.util.R;
import com.bat.vo.AsyncVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

@RequestMapping("/async/")
@RestController
@Slf4j
@Api(tags="异步测试",value ="AsyncController" )
public class AsyncController extends BaseController {

    @Autowired
    private AsyncService asyncService;

    @ApiOperation("异步测试")
    @GetMapping("/testAsync")
    public R<AsyncVo> testAsync(){
        AsyncVo vo=new AsyncVo();
        log.info("1");
        asyncService.age(vo);
        log.info("r1=====");
        log.info("2");
        asyncService.name(vo);
        log.info("3");
        asyncService.nickName(vo);
        log.info("4");
        asyncService.age(vo);
        asyncService.age(vo);
        asyncService.age(vo);
        asyncService.age(vo);
        return success(vo);
    }


}
